const { contextBridge, ipcRenderer } = require('electron');

contextBridge.exposeInMainWorld('electron', {
  onSerialPortDataCatch: (callback) => {
    ipcRenderer.on('serial-port-data-catch', (event, data) => {
      callback(data);
    });
  },
  serialPortList: () => {
    ipcRenderer.send('serial-port-list');
  },
  serialPortClose: () => {
    ipcRenderer.send('serial-port-close');
  },
  quitAppRequest: () => {
    ipcRenderer.send('quit-app-request');
  }
});